<?php

/**
 * Subclass for representing a row from the 'faq_categories' table.
 *
 * 
 *
 * @package lib.model
 */ 
class FaqCategories extends BaseFaqCategories
{
	public function delete($con = null)
	{
		$con = new MysqlDAL('propel');
		$sql = "SELECT COUNT(*) AS total FROM faq_items WHERE cat_id = '{$this->getId()}'";
		$res = $con->doSelect($sql);
		if($res[0]['total'] > 0){
			return false;
		}else{
		 	parent::delete();
		 	return true;
		}
	}
}
